package cn.demengsite.service.impl;

import cn.demengsite.dao.PromotionDAO;
import cn.demengsite.model.BaseInfo;
import cn.demengsite.model.ProductPromotion;
import cn.demengsite.service.PromotionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class PromotionServiceImpl implements PromotionService {

    @Autowired
    private PromotionDAO promotionDAO;

    @Override
    public BaseInfo getAllPromotion(ProductPromotion promotion) {
        List<ProductPromotion>promotions = promotionDAO.getPromotion(promotion);
        return new BaseInfo("0","ok",promotions);
    }

    @Override
    public BaseInfo setNewPromotion(ProductPromotion promotion) {
        promotionDAO.setNewPromotion(promotion);
        return null;
    }

    @Override
    public BaseInfo deletePromotionById(String id) {
        promotionDAO.deletePromotionById(id);
        return null;
    }
}
